﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace iOSRemoteConnector
{
    public static class Devices
    {




        public static Dictionary<String, iOSDevice> devices = new Dictionary<String, iOSDevice>(); 





        // AddNewDevice: Adds to the dictionary a new uuid, iOSDevice pair*/
        public static void AddNewDevice (iOSDevice dev) {

            String identifier = dev.uuid;


            
            devices.Add(identifier, dev); 



        }


        // RemoveDevice: Removes a uuid, iOSDevice and ends the server connection 
        public static void RemoveDevice(String uuid)
        {

            iOSDevice dev = devices[uuid];


            dev.DisconnectDevice(); 


            devices.Remove(uuid); 


        }


     
        // GetDevice: Returns the iOSSocket associated with a particular uuid. 
        public static iOSDevice GetDevice(String uuid)
        {

            return devices[uuid]; 



        }


        // ContainsDevice: Checks if a particular entry is already paired with a device
        public static Boolean ContainsDevice(String uuid)
        {

            return devices.Keys.Contains(uuid);

        }










    }
}